package com.matrix.java.chap_06;

import java.util.Scanner;

/*
    电话按键盘
 */
public class Ex6_21 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter a string: ");
        String str = input.next();
        input.close();
        String outputStr = "";
        for (int i = 0; i < str.length(); i++) {
            char ch = str.toUpperCase().charAt(i);
            if (ch > 64 && ch < 91) {
                outputStr += getNumber(ch);
            } else {
                outputStr += ch;
            }
        }
        System.out.println(outputStr);
    }

    private static int getNumber(char ch) {
        int num = 0;
        if (ch > 64 && ch < 67) {
            num = 2;
        }
        return num;
    }
}
